import Store from '@/store'
import Router from '@/router'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import { setPageTitle } from '@/utils'

NProgress.configure({ showSpinner: true })
if (Store.getters.username) {
  Store.dispatch('fetchMenu')
}
Router.beforeEach((to, from, next) => {
  NProgress.start()
  next()
})

Router.afterEach(() => {
  NProgress.done()
})
